import { request } from '@/app/http'
import { toPageParam, toPageResult } from 'app/converter'

const PATH = '/student'

export async function searchJob(params, pageData) {
  const { data } = await request({
    url: PATH + '/myJob',
    method: 'get',
    params: { ...params, ...toPageParam(pageData) }
  })
  return toPageResult(data)
}

export async function searchJobPost(params, pageData) {
  const { data } = await request({
    url: PATH + '/myJobPost',
    method: 'get',
    params: { ...params, ...toPageParam(pageData) }
  })
  return toPageResult(data)
}

export async function getJobTags() {
  const { data } = await request({
    url: PATH + '/jobTags',
    method: 'get'
  })
  return data
}

export async function queryJob(params, pageData) {
  const { data } = await request({
    url: PATH + '/queryJob',
    method: 'get',
    params: { ...params, ...toPageParam(pageData) }
  })
  return data
}

export async function getJobDetail(params) {
  const { data } = await request({
    url: PATH + '/getJobDetailById',
    method: 'get',
    params
  })
  return data
}

export function postJob(params) {
  return request({
    url: PATH + '/postJob',
    method: 'get',
    params,
    showLoading: true,
    showErr: true
  })
}
